import { MODE } from "../constants";
import { WeaTools } from "ecCom";

export const CallAPI = (url, method, params) => {
  return new Promise((resolve, reject) => {
    WeaTools.callApi(url, method, params).then(({ noRight, ...data }) => {
      resolve(data)
    })
  })
}

export default {
  saveUploadFileInfo: (params) => CallAPI(
    `${MODE}/mode/saveUploadFileInfo`,
    'post',
    params
  ),
  getUploadFieldInfo: (params) => CallAPI(
    `${MODE}/mode/getUploadFieldInfo`,
    'post',
     params
  ),
  saveApp: (params) => CallAPI(
    `${MODE}/app/saveApp`,
    "post",
    params
  ),
  saveMode: (params) => CallAPI(
    `${MODE}/mode/saveModeInfo`,
    'post',
    params
  )
}